package com.example.helloworld;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Regexs {
    public static void main(String[] args) {
        String content = "I am noob " +  "from runoob.com.";
        String pattern = ".*runoob.*";

        Boolean isMatch = Pattern.matches(pattern, content);
        System.out.println(isMatch);


        // 按指定模式在字符串查找
//        String line = "This order was placed for QT3000! OK?";
//        String pattern = "(\\D*)(\\d+)(.*)";
//
//        Pattern r = Pattern.compile(pattern);  // 定义一个验证规则
//
//        Matcher m = r.matcher(line); // 在规则下查询指定字符串
//
//        if(m.find()){
//            System.out.println("Found value: " + m.group(0) );
//            System.out.println("Found value: " + m.group(1) );
//            System.out.println("Found value: " + m.group(2) );
//            System.out.println("Found value: " + m.group(3) );
//        }else {
//            System.out.println("NO MATCH");
//        }
    }
}
